package club.itstudio.itouc.controller.admin

import club.itstudio.itouc.core.util.Result
import club.itstudio.itouc.core.util.ResultUtil
import club.itstudio.itouc.entity.Menu
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/admin")
class AdminMenu {

    @GetMapping("/menu")
    fun menu(): Result<Any> {
        return ResultUtil.success(menu)
    }
}

// 主页
val main = Menu(title = "主页",icon =  "layui-icon-home",jump =  "/")

// 用户管理
val adminManager = Menu("adminManager", "管理员管理", jump = "/menu/user/admin")
val userManager = Menu("userManager", "用户管理", "layui-icon-user", list = listOf(adminManager))

val electiveCourseConfig = Menu("electiveConfig",  "选课配置", jump = "/menu/config/elective")
val lessonDateConfig = Menu("lessonDateConfig", "课程学期", jump = "/menu/config/lessonDate")
val holidayConfig = Menu("holidayConfig", "放假设置", jump = "/menu/config/holiday")
val config = Menu("config", "配置",  "layui-icon-set", list = listOf(electiveCourseConfig, lessonDateConfig, holidayConfig))

// 菜单栏
private val menu = listOf(main, userManager, config)